/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.ultrasoft.farmasoft.domain;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Administrador
 */
@Entity
@Table(name = "decline")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Decline.findAll", query = "SELECT d FROM Decline d"),
    @NamedQuery(name = "Decline.findByDeclineId", query = "SELECT d FROM Decline d WHERE d.declineId = :declineId"),
    @NamedQuery(name = "Decline.findByDate", query = "SELECT d FROM Decline d WHERE d.date = :date"),
    @NamedQuery(name = "Decline.findByReason", query = "SELECT d FROM Decline d WHERE d.reason = :reason"),
    @NamedQuery(name = "Decline.findByRemark", query = "SELECT d FROM Decline d WHERE d.remark = :remark"),
    @NamedQuery(name = "Decline.findByActive", query = "SELECT d FROM Decline d WHERE d.active = :active")})
public class Decline implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "declineId")
    private Integer declineId;
    @Basic(optional = false)
    @Column(name = "date")
    @Temporal(TemporalType.TIMESTAMP)
    private Date date;
    @Basic(optional = false)
    @Column(name = "reason")
    private String reason;
    @Column(name = "remark")
    private String remark;
    @Basic(optional = false)
    @Column(name = "active")
    private boolean active;
    @JoinColumns({
        @JoinColumn(name = "packageId", referencedColumnName = "packageId"),
        @JoinColumn(name = "itemId", referencedColumnName = "itemId")})
    @ManyToOne
    private Item item;
    @JoinColumns({
        @JoinColumn(name = "pharmacyId", referencedColumnName = "pharmacyId"),
        @JoinColumn(name = "userId", referencedColumnName = "userId")})
    @ManyToOne
    private Userpharmacy userpharmacy;

    public Decline() {
    }

    public Decline(Integer declineId) {
        this.declineId = declineId;
    }

    public Decline(Integer declineId, Date date, String reason, boolean active) {
        this.declineId = declineId;
        this.date = date;
        this.reason = reason;
        this.active = active;
    }

    public Integer getDeclineId() {
        return declineId;
    }

    public void setDeclineId(Integer declineId) {
        this.declineId = declineId;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public String getReason() {
        return reason;
    }

    public void setReason(String reason) {
        this.reason = reason;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public boolean getActive() {
        return active;
    }

    public void setActive(boolean active) {
        this.active = active;
    }

    public Item getItem() {
        return item;
    }

    public void setItem(Item item) {
        this.item = item;
    }

    public Userpharmacy getUserpharmacy() {
        return userpharmacy;
    }

    public void setUserpharmacy(Userpharmacy userpharmacy) {
        this.userpharmacy = userpharmacy;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (declineId != null ? declineId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Decline)) {
            return false;
        }
        Decline other = (Decline) object;
        if ((this.declineId == null && other.declineId != null) || (this.declineId != null && !this.declineId.equals(other.declineId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.ultrasoft.farmasoft.domain.Decline[ declineId=" + declineId + " ]";
    }
    
}
